
echo "Step 1: maven build"
echo
#gradle clean build

echo "Step 3: docker image build"
echo
podman build -t ms-binding-svc:11 .

echo "Step 4: login openshift using develper id"
echo
oc login -u=developer -p=developer

echo "step : login default openshift internal registry"
podman login -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.apps-crc.testing --tls-verify=false

echo "step 3.1 tag local image"
podman tag localhost/ms-binding-svc:11 default-route-openshift-image-registry.apps-crc.testing/myproject/ms-binding-svc:11

echo "step 3.2 push local miage to openshift internal registry"
podman push default-route-openshift-image-registry.apps-crc.testing/myproject/ms-binding-svc:11

sleep 10

echo "Step 5: go to correct project"
echo
oc project myproject

echo "Step 6: delete old projects"
echo
oc delete dc ms-binding-svc
oc delete svc ms-binding-svc
oc delete route ms-binding-svc

echo "step 7: create new template and objects"
echo
oc process -f deploy/template.json `cat deploy/local.dat` | oc create -f -

echo "step 8: clean old images"
podman rmi $(podman images -q -f dangling=true)